Static Rankings for Search Queries on Online Social Networks

ABSTRACT

In one embodiment, a method includes accessing a data set comprising a list of objects matching a query, a pre-determined static-rank for each object calculated based on a static-scoring algorithm, and a final-rank for each object calculated based on a final-scoring algorithm, and revising the static-scoring algorithm based on a comparison of the static-ranks and the final-ranks of each object listed in the data set, where the static-scoring algorithm is revised in order to reduce a difference between the static-ranks and final-ranks of the objects listed in the data set.

PRIORITY

This application is a continuation under 35 U.S.C. §120 of U.S. patentapplication Ser. No. 13/954,695, filed 30 Jul. 2013.

TECHNICAL FIELD

This disclosure generally relates to social graphs and performingsearches for objects within a social-networking environment.

BACKGROUND

A social-networking system, which may include a social-networkingwebsite, may enable its users (such as persons or organizations) tointeract with it and with each other through it. The social-networkingsystem may, with input from a user, create and store in thesocial-networking system a user profile associated with the user. Theuser profile may include demographic information, communication-channelinformation, and information on personal interests of the user. Thesocial-networking system may also, with input from a user, create andstore a record of relationships of the user with other users of thesocial-networking system, as well as provide services (e.g. wall posts,photo-sharing, event organization, messaging, games, or advertisements)to facilitate social interaction between or among users.

The social-networking system may send over one or more networks contentor messages related to its services to a mobile or other computingdevice of a user. A user may also install software applications on amobile or other computing device of the user for accessing a userprofile of the user and other data within the social-networking system.The social-networking system may generate a personalized set of contentobjects to display to a user, such as a newsfeed of aggregated storiesof other users connected to the user.

Social-graph analysis views social relationships in terms of networktheory consisting of nodes and edges. Nodes represent the individualactors within the networks, and edges represent the relationshipsbetween the actors. The resulting graph-based structures are often verycomplex. There can be many types of nodes and many types of edges forconnecting nodes. In its simplest form, a social graph is a map of allof the relevant edges between all the nodes being studied.

SUMMARY OF PARTICULAR EMBODIMENTS

In particular embodiments, a user of a social-networking system maysearch for objects associated with the system using a search queries.

In particular embodiments, the social-networking system may improve theprocessing of search queries by improving the static scores/rankings ofobjects stored in data stores. When the social-networking systemretrieves objects from a data store in response to a query, the objectsmay be retrieved based on a pre-determined static-score or static-rankassociated with the object (which may be based, for example, on how theobjects are indexed). The objects retrieved from all data stores maythen be aggregated and scored (based on a variety of factors, such as,for example, relevance to the query, social-graph affinity, userhistory, etc.) by the social-networking system, and these final-scoresor final-ranks may then be used to determine which objects are generatedas search results that are displayed to the querying user. However, thisprocess may be inefficient if the social-networking system has toretrieve an excess of objects from the data stores in order to generatea sufficient number of search results. This process could be improved ifthe static-ranks of objects more closely match the final-ranksdetermined by the social-networking system when generating searchresults for a user. This may allow the social-networking system toreduce the number of matching objects that need to be retrieved in orderto generate a sufficient number of search results in response to aquery. In order to improve the static-scores of objects indexed in oneor more data stores, the social-networking system may compared thestatic-scores of objects retrieved from a data store with thefinal-scores calculated by the social-networking system in order togenerate search results for a user, and revise or adjust thestatic-scores (or the scoring algorithm used to calculate thestatic-scores) of the indexed objects so they more closely match thefinal-scores. For example, the social-networking system may access a setof archived search queries and optimize the static-scores of objectsretrieved by these queries. This may be done for a variety of queries orquery-types, so that the static-scores are optimized to match thefinal-scores as closely as possible for a variety of queries.

In particular embodiments, the social-networking system may improve theprocessing of search queries by improving how query commands aregenerated. When a query is parsed to generate a query command, the querycommand may specify a particular number of objects to retrieve of one ormore object-types. The number of objects to retrieve of each object-typemay be specified by parsing-configuration parameters of the parsingalgorithm used to generate the query commands. The retrieved objects maythen be scored/ranked and the top-N scoring objects may be sent to thequerying user. However, this process may be inefficient if thesocial-networking system has to retrieve an excess of one or moreobject-types from particular data stores in order to retrieve the top-Nscoring objects, particularly with respect to inefficient use ofprocessing power. This process could be improved if the number ofobjects retrieved from each data store could be reduced while stillretrieving some or all of the objects with the best final-scores,allowing the quality of the generated search results that are sent backto the user to be maintained. In order to reduce the number of retrievedobjects, the social-networking system may compare the number of objectsretrieved from each data store with the final-scores for those objectsas calculated by the social-networking system, and revise the parsingalgorithm so query commands request fewer objects while stillmaintaining substantially the same quality of search results. Forexample, the social-networking system may access a set of archivedsearch queries and optimize the parsing algorithm based on thefinal-scores of the objects retrieved by these queries. The archivedqueries may be submitted to one or more data stores, which may retrievea first number of results based the number of objects to retrievespecified by the query commands generated for those queries by theparsing algorithm. Each retrieved object may then be scored to determinea final-score/rank, which may then be compared to the number of objectsretrieved to determine whether the number of objects retrieved for aparticular object-type can be reduced while still retrieving asufficient number of the top-N scoring results. If so, then the parsingalgorithm is may be revised so that query commands generated in responseto particular queries specify retrieving fewer objects or object-types.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example network environment associated with asocial-networking system.

FIG. 2 illustrates an example social graph.

FIG. 3 illustrates an example partitioning for storing objects of asocial-networking system.

FIG. 4 illustrates an example webpage of an online social network.

FIGS. 5A-5B illustrate example queries of the social network.

FIG. 6 illustrates an example method for improving the static-scoring ofobjects for search queries.

FIG. 7 illustrates an example method for improving the parsing of searchqueries.

FIG. 8 illustrates an example computer system.

DESCRIPTION OF EXAMPLE EMBODIMENTS

FIG. 1 illustrates an example network environment 100 associated with asocial-networking system. Network environment 100 includes client system130, social-networking system 160, and third-party system 170 connectedto each other by a network 110. Although FIG. 1 illustrates a particulararrangement of client system 130, social-networking system 160,third-party system 170, and network 110, this disclosure contemplatesany suitable arrangement of client system 130, social-networking system160, third-party system 170, and network 110. As an example and not byway of limitation, two or more of client system 130, social-networkingsystem 160, and third-party system 170 may be connected to each otherdirectly, bypassing network 110. As another example, two or more ofclient system 130, social-networking system 160, and third-party system170 may be physically or logically co-located with each other in wholeor in part. Moreover, although FIG. 1 illustrates a particular number ofclient systems 130, social-networking systems 160, third-party systems170, and networks 110, this disclosure contemplates any suitable numberof client systems 130, social-networking systems 160, third-partysystems 170, and networks 110. As an example and not by way oflimitation, network environment 100 may include multiple client system130, social-networking systems 160, third-party systems 170, andnetworks 110.

This disclosure contemplates any suitable network 110. As an example andnot by way of limitation, one or more portions of network 110 mayinclude an ad hoc network, an intranet, an extranet, a virtual privatenetwork (VPN), a local area network (LAN), a wireless LAN (WLAN), a widearea network (WAN), a wireless WAN (WWAN), a metropolitan area network(MAN), a portion of the Internet, a portion of the Public SwitchedTelephone Network (PSTN), a cellular telephone network, or a combinationof two or more of these. Network 110 may include one or more networks110.

Links 150 may connect client system 130, social-networking system 160,and third-party system 170 to communication network 110 or to eachother. This disclosure contemplates any suitable links 150. Inparticular embodiments, one or more links 150 include one or morewireline (such as for example Digital Subscriber Line (DSL) or Data OverCable Service Interface Specification (DOCSIS)), wireless (such as forexample Wi-Fi or Worldwide Interoperability for Microwave Access(WiMAX)), or optical (such as for example Synchronous Optical Network(SONET) or Synchronous Digital Hierarchy (SDH)) links. In particularembodiments, one or more links 150 each include an ad hoc network, anintranet, an extranet, a VPN, a LAN, a WLAN, a WAN, a WWAN, a MAN, aportion of the Internet, a portion of the PSTN, a cellulartechnology-based network, a satellite communications technology-basednetwork, another link 150, or a combination of two or more such links150. Links 150 need not necessarily be the same throughout networkenvironment 100. One or more first links 150 may differ in one or morerespects from one or more second links 150.

In particular embodiments, client system 130 may be an electronic deviceincluding hardware, software, or embedded logic components or acombination of two or more such components and capable of carrying outthe appropriate functionalities implemented or supported by clientsystem 130. As an example and not by way of limitation, client system130 may include a computer system such as a desktop computer, notebookor laptop computer, netbook, a tablet computer, e-book reader, GPSdevice, camera, personal digital assistant (PDA), handheld electronicdevice, cellular telephone, smartphone, other suitable electronicdevice, or any suitable combination thereof. This disclosurecontemplates any suitable client systems 130. Client system 130 mayenable a network user at client system 130 to access network 110. Clientsystem 130 may enable its user to communicate with other users at otherclient systems 130.

In particular embodiments, client system 130 may include a web browser132, such as MICROSOFT INTERNET EXPLORER, GOOGLE CHROME or MOZILLAFIREFOX, and may have one or more add-ons, plug-ins, or otherextensions, such as TOOLBAR or YAHOO TOOLBAR. A user at client system130 may enter a Uniform Resource Locator (URL) or other addressdirecting the web browser 132 to a particular server (such as server162, or a server associated with third-party system 170), and the webbrowser 132 may generate a Hyper Text Transfer Protocol (HTTP) requestand communicate the HTTP request to server. The server may accept theHTTP request and communicate to client system 130 one or more Hyper TextMarkup Language (HTML) files responsive to the HTTP request. Clientsystem 130 may render a webpage based on the HTML files from the serverfor presentation to the user. This disclosure contemplates any suitablewebpage files. As an example and not by way of limitation, webpages mayrender from HTML files, Extensible Hyper Text Markup Language (XHTML)files, or Extensible Markup Language (XML) files, according toparticular needs. Such pages may also execute scripts such as, forexample and without limitation, those written in JAVASCRIPT, JAVA,MICROSOFT SILVERLIGHT, combinations of markup language and scripts suchas AJAX (Asynchronous JAVASCRIPT and XML), and the like. Herein,reference to a webpage encompasses one or more corresponding webpagefiles (which a browser may use to render the webpage) and vice versa,where appropriate.

In particular embodiments, social-networking system 160 may be anetwork-addressable computing system that can host an online socialnetwork. Social-networking system 160 may generate, store, receive, andsend social-networking data, such as, for example, user-profile data,concept-profile data, social-graph information, or other suitable datarelated to the online social network. Social-networking system 160 maybe accessed by the other components of network environment 100 eitherdirectly or via network 110. In particular embodiments,social-networking system 160 may include one or more servers 162. Eachserver 162 may be a unitary server or a distributed server spanningmultiple computers or multiple datacenters. Servers 162 may be ofvarious types, such as, for example and without limitation, web server,news server, mail server, message server, advertising server, fileserver, application server, exchange server, database server, proxyserver, another server suitable for performing functions or processesdescribed herein, or any combination thereof. In particular embodiments,each server 162 may include hardware, software, or embedded logiccomponents or a combination of two or more such components for carryingout the appropriate functionalities implemented or supported by server162. In particular embodiments, social-networking system 164 may includeone or more data stores 164. Data stores 164 may be used to storevarious types of information. In particular embodiments, the informationstored in data stores 164 may be organized according to specific datastructures. In particular embodiments, each data store 164 may be arelational, columnar, correlation, or other suitable database. Althoughthis disclosure describes or illustrates particular types of databases,this disclosure contemplates any suitable types of databases. Particularembodiments may provide interfaces that enable client system 130,social-networking system 160, or third-party system 170 to manage,retrieve, modify, add, or delete, the information stored in data store164.

In particular embodiments, social-networking system 160 may store one ormore social graphs in one or more data stores 164. In particularembodiments, a social graph may include multiple nodes—which may includemultiple user nodes (each corresponding to a particular user) ormultiple concept nodes (each corresponding to a particular concept)—andmultiple edges connecting the nodes. Social-networking system 160 mayprovide users of the online social network the ability to communicateand interact with other users. In particular embodiments, users may jointhe online social network via social-networking system 160 and then addconnections (i.e., relationships) to a number of other users ofsocial-networking system 160 whom they want to be connected to. Herein,the term “friend” may refer to any other user of social-networkingsystem 160 with whom a user has formed a connection, association, orrelationship via social-networking system 160.

In particular embodiments, social-networking system 160 may provideusers with the ability to take actions on various types of items orobjects, supported by social-networking system 160. As an example andnot by way of limitation, the items and objects may include groups orsocial networks to which users of social-networking system 160 maybelong, events or calendar entries in which a user might be interested,computer-based applications that a user may use, transactions that allowusers to buy or sell items via the service, interactions withadvertisements that a user may perform, or other suitable items orobjects. A user may interact with anything that is capable of beingrepresented in social-networking system 160 or by an external system ofthird-party system 170, which is separate from social-networking system160 and coupled to social-networking system 160 via a network 110.

In particular embodiments, social-networking system 160 may be capableof linking a variety of entities. As an example and not by way oflimitation, social-networking system 160 may enable users to interactwith each other as well as receive content from third-party systems 170or other entities, or to allow users to interact with these entitiesthrough an application programming interfaces (API) or othercommunication channels.

In particular embodiments, third-party system 170 may include one ormore types of servers, one or more data stores, one or more interfaces,including but not limited to APIs, one or more web services, one or morecontent sources, one or more networks, or any other suitable components,e.g., that servers may communicate with. A third-party system 170 may beoperated by a different entity from an entity operatingsocial-networking system 160. In particular embodiments, however,social-networking system 160 and third-party systems 170 may operate inconjunction with each other to provide social-networking services tousers of social-networking system 160 or third-party systems 170. Inthis sense, social-networking system 160 may provide a platform, orbackbone, which other systems, such as third-party systems 170, may useto provide social-networking services and functionality to users acrossthe Internet.

In particular embodiments, third-party system 170 may include athird-party content object provider. A third-party content objectprovider may include one or more sources of content objects, which maybe communicated to client system 130. As an example and not by way oflimitation, content objects may include information regarding things oractivities of interest to the user, such as, for example, movie showtimes, movie reviews, restaurant reviews, restaurant menus, productinformation and reviews, or other suitable information. As anotherexample and not by way of limitation, content objects may includeincentive content objects, such as coupons, discount tickets, giftcertificates, or other suitable incentive objects.

In particular embodiments, social-networking system 160 also includesuser-generated content objects, which may enhance a user's interactionswith social-networking system 160. User-generated content may includeanything a user can add, upload, send, or “post” to social-networkingsystem 160. As an example and not by way of limitation, a usercommunicates posts to social-networking system 160 from client system130. Posts may include data such as status updates or other textualdata, location information, photos, videos, links, music or othersimilar data or media. Content may also be added to social-networkingsystem 160 by a third-party through a “communication channel,” such as anewsfeed or stream.

In particular embodiments, social-networking system 160 may include avariety of servers, sub-systems, programs, modules, logs, and datastores. In particular embodiments, social-networking system 160 mayinclude one or more of the following: a web server, action logger,API-request server, relevance-and-ranking engine, content-objectclassifier, notification controller, action log,third-party-content-object-exposure log, inference module,authorization/privacy server, search module, ad-targeting module,user-interface module, user-profile store, connection store, third-partycontent store, or location store. Social-networking system 160 may alsoinclude suitable components such as network interfaces, securitymechanisms, load balancers, failover servers,management-and-network-operations consoles, other suitable components,or any suitable combination thereof. In particular embodiments,social-networking system 160 may include one or more user-profile storesfor storing user profiles. A user profile may include, for example,biographic information, demographic information, behavioral information,social information, or other types of descriptive information, such aswork experience, educational history, hobbies or preferences, interests,affinities, or location. Interest information may include interestsrelated to one or more categories. Categories may be general orspecific. As an example and not by way of limitation, if a user “likes”an article about a brand of shoes the category may be the brand, or thegeneral category of “shoes” or “clothing.” A connection store may beused for storing connection information about users. The connectioninformation may indicate users who have similar or common workexperience, group memberships, hobbies, educational history, or are inany way related or share common attributes. The connection informationmay also include user-defined connections between different users andcontent (both internal and external). A web server may be used forlinking social-networking system 160 to one or more client systems 130or one or more third-party system 170 via network 110. The web servermay include a mail server or other messaging functionality for receivingand routing messages between social-networking system 160 and one ormore client systems 130. An API-request server may allow third-partysystem 170 to access information from social-networking system 160 bycalling one or more APIs. An action logger may be used to receivecommunications from a web server about a user's actions on or offsocial-networking system 160. In conjunction with the action log, athird-party-content-object log may be maintained of user exposures tothird-party-content objects. A notification controller may provideinformation regarding content objects to client system 130. Informationmay be pushed to client system 130 as notifications, or information maybe pulled from client system 130 responsive to a request received fromclient system 130. Authorization servers may be used to enforce one ormore privacy settings of the users of social-networking system 160. Aprivacy setting of a user determines how particular informationassociated with a user can be shared. The authorization server may allowusers to opt in or opt out of having their actions logged bysocial-networking system 160 or shared with other systems (e.g.,third-party system 170), such as, for example, by setting appropriateprivacy settings. Third-party-content-object stores may be used to storecontent objects received from third parties, such as third-party system170. Location stores may be used for storing location informationreceived from client systems 130 associated with users.Advertisement-pricing modules may combine social information, thecurrent time, location information, or other suitable information toprovide relevant advertisements, in the form of notifications, to auser.

FIG. 2 illustrates example social graph 200. In particular embodiments,social-networking system 160 may store one or more social graphs 200 inone or more data stores. In particular embodiments, social graph 200 mayinclude multiple nodes—which may include multiple user nodes 202 ormultiple concept nodes 204—and multiple edges 206 connecting the nodes.Example social graph 200 illustrated in FIG. 2 is shown, for didacticpurposes, in a two-dimensional visual map representation. In particularembodiments, social-networking system 160, client system 130, orthird-party system 170 may access social graph 200 and relatedsocial-graph information for suitable applications. The nodes and edgesof social graph 200 may be stored as data objects, for example, in adata store (such as a social-graph database). Such a data store mayinclude one or more searchable or queryable indexes of nodes or edges ofsocial graph 200.

In particular embodiments, a user node 202 may correspond to a user ofsocial-networking system 160. As an example and not by way oflimitation, a user may be an individual (human user), an entity (e.g.,an enterprise, business, or third-party application), or a group (e.g.,of individuals or entities) that interacts or communicates with or oversocial-networking system 160. In particular embodiments, when a userregisters for an account with social-networking system 160,social-networking system 160 may create a user node 202 corresponding tothe user, and store the user node 202 in one or more data stores. Usersand user nodes 202 described herein may, where appropriate, refer toregistered users and user nodes 202 associated with registered users. Inaddition or as an alternative, users and user nodes 202 described hereinmay, where appropriate, refer to users that have not registered withsocial-networking system 160. In particular embodiments, a user node 202may be associated with information provided by a user or informationgathered by various systems, including social-networking system 160. Asan example and not by way of limitation, a user may provide his or hername, profile picture, contact information, birth date, sex, maritalstatus, family status, employment, education background, preferences,interests, or other demographic information. In particular embodiments,a user node 202 may be associated with one or more data objectscorresponding to information associated with a user. In particularembodiments, a user node 202 may correspond to one or more webpages.

In particular embodiments, a concept node 204 may correspond to aconcept. As an example and not by way of limitation, a concept maycorrespond to a place (such as, for example, a movie theater,restaurant, landmark, or city); a website (such as, for example, awebsite associated with social-network system 160 or a third-partywebsite associated with a web-application server); an entity (such as,for example, a person, business, group, sports team, or celebrity); aresource (such as, for example, an audio file, video file, digitalphoto, text file, structured document, or application) which may belocated within social-networking system 160 or on an external server,such as a web-application server; real or intellectual property (suchas, for example, a sculpture, painting, movie, game, song, idea,photograph, or written work); a game; an activity; an idea or theory;another suitable concept; or two or more such concepts. A concept node204 may be associated with information of a concept provided by a useror information gathered by various systems, including social-networkingsystem 160. As an example and not by way of limitation, information of aconcept may include a name or a title; one or more images (e.g., animage of the cover page of a book); a location (e.g., an address or ageographical location); a website (which may be associated with a URL);contact information (e.g., a phone number or an email address); othersuitable concept information; or any suitable combination of suchinformation. In particular embodiments, a concept node 204 may beassociated with one or more data objects corresponding to informationassociated with concept node 204. In particular embodiments, a conceptnode 204 may correspond to one or more webpages.

In particular embodiments, a node in social graph 200 may represent orbe represented by a webpage (which may be referred to as a “profilepage”). Profile pages may be hosted by or accessible tosocial-networking system 160. Profile pages may also be hosted onthird-party websites associated with a third-party server 170. As anexample and not by way of limitation, a profile page corresponding to aparticular external webpage may be the particular external webpage andthe profile page may correspond to a particular concept node 204.Profile pages may be viewable by all or a selected subset of otherusers. As an example and not by way of limitation, a user node 202 mayhave a corresponding user-profile page in which the corresponding usermay add content, make declarations, or otherwise express himself orherself. As another example and not by way of limitation, a concept node204 may have a corresponding concept-profile page in which one or moreusers may add content, make declarations, or express themselves,particularly in relation to the concept corresponding to concept node204.

In particular embodiments, a concept node 204 may represent athird-party webpage or resource hosted by third-party system 170. Thethird-party webpage or resource may include, among other elements,content, a selectable or other icon, or other inter-actable object(which may be implemented, for example, in JavaScript, AJAX, or PHPcodes) representing an action or activity. As an example and not by wayof limitation, a third-party webpage may include a selectable icon suchas “like,” “check in,” “eat,” “recommend,” or another suitable action oractivity. A user viewing the third-party webpage may perform an actionby selecting one of the icons (e.g., “eat”), causing client system 130to send to social-networking system 160 a message indicating the user'saction. In response to the message, social-networking system 160 maycreate an edge (e.g., an “eat” edge) between a user node 202corresponding to the user and a concept node 204 corresponding to thethird-party webpage or resource and store edge 206 in one or more datastores.

In particular embodiments, a pair of nodes in social graph 200 may beconnected to each other by one or more edges 206. An edge 206 connectinga pair of nodes may represent a relationship between the pair of nodes.In particular embodiments, an edge 206 may include or represent one ormore data objects or attributes corresponding to the relationshipbetween a pair of nodes. As an example and not by way of limitation, afirst user may indicate that a second user is a “friend” of the firstuser. In response to this indication, social-networking system 160 maysend a “friend request” to the second user. If the second user confirmsthe “friend request,” social-networking system 160 may create an edge206 connecting the first user's user node 202 to the second user's usernode 202 in social graph 200 and store edge 206 as social-graphinformation in one or more of data stores 24. In the example of FIG. 2,social graph 200 includes an edge 206 indicating a friend relationbetween user nodes 202 of user “A” and user “B” and an edge indicating afriend relation between user nodes 202 of user “C” and user “B.”Although this disclosure describes or illustrates particular edges 206with particular attributes connecting particular user nodes 202, thisdisclosure contemplates any suitable edges 206 with any suitableattributes connecting user nodes 202. As an example and not by way oflimitation, an edge 206 may represent a friendship, family relationship,business or employment relationship, fan relationship, followerrelationship, visitor relationship, subscriber relationship,superior/subordinate relationship, reciprocal relationship,non-reciprocal relationship, another suitable type of relationship, ortwo or more such relationships. Moreover, although this disclosuregenerally describes nodes as being connected, this disclosure alsodescribes users or concepts as being connected. Herein, references tousers or concepts being connected may, where appropriate, refer to thenodes corresponding to those users or concepts being connected in socialgraph 200 by one or more edges 206.

In particular embodiments, an edge 206 between a user node 202 and aconcept node 204 may represent a particular action or activity performedby a user associated with user node 202 toward a concept associated witha concept node 204. As an example and not by way of limitation, asillustrated in FIG. 2, a user may “like,” “attended,” “played,”“listened,” “cooked,” “worked at,” or “watched” a concept, each of whichmay correspond to a edge type or subtype. A concept-profile pagecorresponding to a concept node 204 may include, for example, aselectable “check in” icon (such as, for example, a clickable “check in”icon) or a selectable “add to favorites” icon. Similarly, after a userclicks these icons, social-networking system 160 may create a “favorite”edge or a “check in” edge in response to a user's action correspondingto a respective action. As another example and not by way of limitation,a user (user “C”) may listen to a particular song (“Imagine”) using aparticular application (SPOTIFY, which is an online music application).In this case, social-networking system 160 may create a “listened” edge206 and a “used” edge (as illustrated in FIG. 2) between user nodes 202corresponding to the user and concept nodes 204 corresponding to thesong and application to indicate that the user listened to the song andused the application. Moreover, social-networking system 160 may createa “played” edge 206 (as illustrated in FIG. 2) between concept nodes 204corresponding to the song and the application to indicate that theparticular song was played by the particular application. In this case,“played” edge 206 corresponds to an action performed by an externalapplication (SPOTIFY) on an external audio file (the song “Imagine”).Although this disclosure describes particular edges 206 with particularattributes connecting user nodes 202 and concept nodes 204, thisdisclosure contemplates any suitable edges 206 with any suitableattributes connecting user nodes 202 and concept nodes 204. Moreover,although this disclosure describes edges between a user node 202 and aconcept node 204 representing a single relationship, this disclosurecontemplates edges between a user node 202 and a concept node 204representing one or more relationships. As an example and not by way oflimitation, an edge 206 may represent both that a user likes and hasused at a particular concept. Alternatively, another edge 206 mayrepresent each type of relationship (or multiples of a singlerelationship) between a user node 202 and a concept node 204 (asillustrated in FIG. 2 between user node 202 for user “E” and conceptnode 204 for “SPOTIFY”).

In particular embodiments, social-networking system 160 may create anedge 206 between a user node 202 and a concept node 204 in social graph200. As an example and not by way of limitation, a user viewing aconcept-profile page (such as, for example, by using a web browser or aspecial-purpose application hosted by the user's client system 130) mayindicate that he or she likes the concept represented by the conceptnode 204 by clicking or selecting a “Like” icon, which may cause theuser's client system 130 to send to social-networking system 160 amessage indicating the user's liking of the concept associated with theconcept-profile page. In response to the message, social-networkingsystem 160 may create an edge 206 between user node 202 associated withthe user and concept node 204, as illustrated by “like” edge 206 betweenthe user and concept node 204. In particular embodiments,social-networking system 160 may store an edge 206 in one or more datastores. In particular embodiments, an edge 206 may be automaticallyformed by social-networking system 160 in response to a particular useraction. As an example and not by way of limitation, if a first useruploads a picture, watches a movie, or listens to a song, an edge 206may be formed between user node 202 corresponding to the first user andconcept nodes 204 corresponding to those concepts. Although thisdisclosure describes forming particular edges 206 in particular manners,this disclosure contemplates forming any suitable edges 206 in anysuitable manner.

FIG. 3 illustrates an example partitioning for storing objects ofsocial-networking system 160. A plurality of data stores 164 (which mayalso be called “verticals”) may store objects of social-networkingsystem 160. The amount of data (e.g., data for a social graph 200)stored in the data stores may be very large. As an example and not byway of limitation, a social graph used by Facebook, Inc. of Menlo Park,Calif. can have a number of nodes in the order of 10⁸, and a number ofedges in the order of 10¹⁰. Typically, a large collection of data suchas a large database may be divided into a number of partitions. As theindex for each partition of a database is smaller than the index for theoverall database, the partitioning may improve performance in accessingthe database. As the partitions may be distributed over a large numberof servers, the partitioning may also improve performance andreliability in accessing the database. Ordinarily, a database may bepartitioned by storing rows (or columns) of the database separately. Inparticular embodiments, a database maybe partitioned by based onobject-types. Data objects may be stored in a plurality of partitions,each partition holding data objects of a single object-type. Inparticular embodiments, social-networking system 160 may retrieve searchresults in response to a search query by submitting the search query toa particular partition storing objects of the same object-type as thesearch query's expected results. Although this disclosure describesstoring objects in a particular manner, this disclosure contemplatesstoring objects in any suitable manner.

In particular embodiments, each object may correspond to a particularnode of a social graph 200. An edge 206 connecting the particular nodeand another node may indicate a relationship between objectscorresponding to these nodes. In addition to storing objects, aparticular data store may also store social-graph information relatingto the object. Alternatively, social-graph information about particularobjects may be stored in a different data store from the objects.Social-networking system 160 may update the search index of the datastore based on newly received objects, and relationships associated withthe received objects.

In particular embodiments, each data store 164 may be configured tostore objects of a particular one of a plurality of object-types inrespective data storage devices 340. An object-type may be, for example,a user, a photo, a post, a comment, a message, an event listing, awebpage, an application, a user-profile page, a concept-profile page, auser group, an audio file, a video, an offer/coupon, or another suitabletype of object. Although this disclosure describes particular types ofobjects, this disclosure contemplates any suitable types of objects. Asan example and not by way of limitation, a user vertical P1 illustratedin FIG. 3 may store user objects. Each user object stored in the uservertical P1 may comprise an identifier (e.g., a character string), auser name, and a profile picture for a user of the online socialnetwork. Social-networking system 160 may also store in the uservertical P1 information associated with a user object such as language,location, education, contact information, interests, relationshipstatus, a list of friends/contacts, a list of family members, privacysettings, and so on. As an example and not by way of limitation, a postvertical P2 illustrated in FIG. 3 may store post objects. Each postobject stored in the post vertical P2 may comprise an identifier, a textstring for a post posted to social-networking system 160.Social-networking system 160 may also store in the post vertical P2information associated with a post object such as a time stamp, anauthor, privacy settings, users who like the post, a count of likes,comments, a count of comments, location, and so on. As an example andnot by way of limitation, a photo vertical P3 may store photo objects(or objects of other media types such as video or audio). Each photoobject stored in the photo vertical P3 may comprise an identifier and aphoto. Social-networking system 160 may also store in the photo verticalP3 information associated with a photo object such as a time stamp, anauthor, privacy settings, users who are tagged in the photo, users wholike the photo, comments, and so on. In particular embodiments, eachdata store may also be configured to store information associated witheach stored object in data storage devices 340.

In particular embodiments, objects stored in each vertical 164 may beindexed by one or more search indices. The search indices may be hostedby respective index server 330 comprising one or more computing devices(e.g., servers). The index server 330 may update the search indicesbased on data (e.g., a photo and information associated with a photo)submitted to social-networking system 160 by users or other processes ofsocial-networking system 160 (or a third-party system). The index server330 may also update the search indices periodically (e.g., every 24hours). The index server 330 may receive a query comprising a searchterm, and access and retrieve search results from one or more searchindices corresponding to the search term. In some embodiments, avertical corresponding to a particular object-type may comprise aplurality of physical or logical partitions, each comprising respectivesearch indices.

In particular embodiments, social-networking system 160 may receive asearch query from a PHP (Hypertext Preprocessor) process 310. The PHPprocess 310 may comprise one or more computing processes hosted by oneor more servers 162 of social-networking system 160. The search querymay be a text string or a structured query submitted to the PHP processby a user or another process of social-networking system 160 (orthird-party system 170).

More information on indexes and search queries may be found in U.S.patent application Ser. No. 13/560,212, filed 27 Jul. 2012, U.S. patentapplication Ser. No. 13/560,901, filed 27 Jul. 2012, U.S. patentapplication Ser. No. 13/723,861, filed 21 Dec. 2012, and U.S. patentapplication Ser. No. 13/870,113, filed 25 Apr. 2013, each of which isincorporated by reference.

FIG. 4 illustrates an example webpage of an online social network. Inparticular embodiments, a user may submit a query to the social-networksystem 160 by inputting text into query field 450. A user of an onlinesocial network may search for particular content objects (hereinafter“objects”) or content-object-types (hereinafter “object-types”)associated with the online social network (e.g., users, concepts,webpages, external content or resources) by providing a short phrasedescribing the object or object-type, often referred to as a “searchquery,” to a search engine. The query may be a text query and maycomprise one or more character strings (which may include one or moren-grams). In general, a user may input any character string comprisingone or more characters into query field 450 to search for objects onsocial-networking system 160 that match at least a portion of thecharacter string. Social-networking system 160 may then search one ormore verticals 164 to identify objects matching the query. The searchengine may conduct a search based on the query using various searchalgorithms and generate search results that identify objects (e.g.,user-profile pages, content-profile pages, or external resources) thatare most likely to be related to the search query. To conduct a search,a user may input or send a search query to the search engine. Inresponse, the search engine may identify one or more resources that arelikely to be related to the search query, each of which may individuallybe referred to as a “search result,” or collectively be referred to asthe “search results” corresponding to the search query. The identifiedobjects may include, for example, social-graph elements (i.e., usernodes 202, concept nodes 204, edges 206), profile pages, externalwebpages, or any combination thereof. Social-networking system 160 maythen generate a search-results webpage with search results correspondingto the identified objects and send the search-results webpage to theuser. In particular embodiments, the search engine may limit its searchto objects associated with the online social network. However, inparticular embodiments, the search engine may also search for objectsassociated with other sources, such as third-party system 170, theinternet or World Wide Web, or other suitable sources. Although thisdisclosure describes querying social-networking system 160 in aparticular manner, this disclosure contemplates queryingsocial-networking system 160 in any suitable manner.

In connection with search queries and search results, particularembodiments may utilize one or more systems, components, elements,functions, methods, operations, or steps disclosed in U.S. patentapplication Ser. No. 11/503,093, filed 11 Aug. 2006, U.S. patentapplication Ser. No. 12/763,162, filed 19 Apr. 2010, U.S. patentapplication Ser. No. 12/977,027, filed 22 Dec. 2010, U.S. patentapplication Ser. No. 12/978,265, filed 23 Dec. 2010, U.S. patentapplication Ser. No. 13/556,072, filed 23 Jul. 2012, and U.S. patentapplication Ser. No. 13/732,101, filed 31 Dec. 2012, each of which isincorporated by reference.

In particular embodiments, social-networking system 160 may improve theprocessing of search queries by improving the static scores/rankings ofobjects stored in data stores 164. When social-networking system 160retrieves objects from a data store 164 in response to a query, theobjects may be retrieved based on a pre-determined static-score orstatic-rank associated with the object (which may be based, for example,on how the objects are indexed). The objects retrieved from all datastores 164 may then be aggregated and scored (based on a variety offactors, such as, for example, relevance to the query, social-graphaffinity, user history, etc.) by social-networking system 160, and thesefinal-scores or final-ranks may then be used to determine which objectsare generated as search results that are displayed to the querying user.However, this process may be inefficient if social-networking system 160has to retrieve an excess of objects from the data stores 164 in orderto generate a sufficient number of search results. As an example and notby way of limitation, if social-networking system 160 retrieves 100matching objects from a particular data store 164, where each object hasan associated static-rank, and then these 100 objects are scored bysocial-networking system 160, the top-five ranked objects might be, forexample, objects having static-ranks of 4, 12, 20, 78, and 95. Thisprocess could be improved if the static-ranks of objects more closelymatch the final-ranks determined by social-networking system 160 whengenerating search results for a user. This may allow social-networkingsystem 160 to reduce the number of matching objects that need to beretrieved in order to generate a sufficient number of search results inresponse to a query. In order to improve the static-scores of objectsindexed in one or more data stores 164, social-networking system 160 maycompared the static-scores of objects retrieved from a data store 164with the final-score calculated by social-networking system 160 in orderto generate search results for a user, and revise or adjust thestatic-scores (or the scoring algorithm used to calculate thestatic-scores) of the indexed objects so they more closely match thefinal-scores. As an example and not by way of limitation,social-networking system 160 may access a set of archived search queriesand optimize the static-scores of objects retrieved by these queries.The archived queries may be submitted to one or more data stores 164,which may retrieve a first number of results based on theirstatic-ranks. Each retrieved objects may then scored to determine afinal-rank, which may then be compared to the static-rank, and thestatic-rank may be modified so it more closely matches the final-rank.This may be done for a variety of queries or query types, so that thestatic-scores are optimized to match the final-scores as closely aspossible for a variety of queries. Although this disclosure describesimproving static rankings in a particular manner, this disclosurecontemplates improving static rankings in any suitable manner.

In particular embodiments, social-networking system 160 may improve theprocessing of search queries by improving how query commands aregenerated. When a query is parsed to generate a query command, the querycommand may specify a particular number of objects to retrieve of one ormore object-types (e.g., the number to score for each vertical 164accessed). As an example and not by way of limitation, in response tothe text query “steph”, social-networking system 160 may generate aquery command that requests ten first-degree connections of the queryinguser from a users vertical 164, fifty second-degree connections, andtwenty pages from a pages vertical 164. The number of objects toretrieve of each object-type may be specified by parsing-configurationparameters of the parsing algorithm used to generate the query commands.The retrieved objects may then be scored/ranked and the top-N scoringobjects may be sent to the querying user. However, this process may beinefficient if social-networking system 160 has to retrieve an excess ofone or more object-types from particular verticals 164 in order toretrieve the top-N scoring objects, particularly with respect toinefficient use of processing (CPU) power. This process could beimproved if the number of objects retrieved from each vertical 164 couldbe reduced while still retrieving some or all of the objects with thebest final-scores/ranks, allowing the quality of the generated searchresults that are sent back to the user to be maintained. As an exampleand not by way of limitation, continuing with the prior example, it maybe possible to generate search results of the same quality (i.e., stillretrieve substantially all of the top-N scoring objects) by generating aquery command that only requests ten first-degree connections,twenty-five second-degree connections (instead of fifty), and ten pages(instead of twenty). In order to reduce the number of retrieved objects,social-networking system 160 may compare the number of objects retrievedfrom each vertical 164 with the final-scores for those objects ascalculated by social-networking system 160, and revise the parsingalgorithm so query commands request fewer objects while stillmaintaining substantially the same quality of search results. As anexample and not by way of limitation, social-networking system 160 mayaccess a set of archived search queries and optimize the parsingalgorithm based on the final-scores of the objects retrieved by thesequeries. The archived queries may be submitted to one or more datastores 164, which may retrieve a first number of results based thenumber of objects to retrieve specified by the query commands generatedfor those queries by the parsing algorithm. Each retrieved object maythen be scored to determine a final-score/rank, which may then becompared to the number of objects retrieved to determine whether thenumber of objects retrieved for a particular object-type can be reducedwhile still retrieving the top-N scoring results (or at least retrievinga sufficient number of the top-N results). If so, then the parsingalgorithm is may be revised so that query commands generated in responseto particular queries specify retrieving fewer objects or object-types.Although this disclosure describes improving how query commands aregenerated in a particular manner, this disclosure contemplates improvinghow query commands are improved in any suitable manner.

In particular embodiments, social-networking system 160 may access a setof queries of the online social network received from one or more usersof the online social network. Search queries submitted by users may besaved by social-networking system 160 and later retrieved in order torun experiments to optimize the processing of search queries. As anexample and not by way of limitation, the set of queries may comprise aplurality of archived queries from a plurality of users of the onlinesocial network. Experiments using the archived queries may be done, forexample, by having social-networking system 160 execute the queries,analyze the parsing of the queries and the objects retrieved by thequeries, and then optimizing particular aspects of the querying process.Although this disclosure describes accessing particular sets of queriesin a particular manner, this disclosure contemplates accessing anysuitable sets of queries in any suitable manner.

FIGS. 5A-5B illustrate example queries of the online social network. Inparticular embodiments, in response to a text query received from afirst user (i.e., the querying user), social-networking system 160 mayparse the text query and identify portions of the text query thatcorrespond to particular social-graph elements. Social-networking system160 may then generate a set of structured queries, where each structuredquery corresponds to one of the possible matching social-graph elements.These structured queries may be based on strings generated by a grammarmodel, such that they are rendered in a natural-language syntax withreferences to the relevant social-graph elements. These structuredqueries may be presented to the querying user, who can then select amongthe structured queries to indicate that the selected structured queryshould be run by social-networking system 160. FIGS. 5A-5B illustratevarious example text queries in query field 450 and various structuredqueries generated in response in drop-down menus 400 (although othersuitable graphical user interfaces are possible). By providing suggestedstructured queries in response to a user's text query, social-networkingsystem 160 may provide a powerful way for users of the online socialnetwork to search for elements represented in the social graph 200 basedon their social-graph attributes and their relation to varioussocial-graph elements. Structured queries may allow a querying user tosearch for content that is connected to particular users or concepts inthe social graph 200 by particular edge-types. The structured queriesmay be sent to the first user and displayed in a drop-down menu 400(via, for example, a client-side typeahead process), where the firstuser can then select an appropriate query to search for the desiredcontent. Some of the advantages of using the structured queriesdescribed herein include finding users of the online social networkbased upon limited information, bringing together virtual indexes ofcontent from the online social network based on the relation of thatcontent to various social-graph elements, or finding content related toyou and/or your friends. Although this disclosure describes and FIGS.5A-5B illustrate generating particular structured queries in aparticular manner, this disclosure contemplates generating any suitablestructured queries in any suitable manner.

In particular embodiments, social-networking system 160 may receive froma querying/first user (corresponding to a first user node 202) anunstructured text query. As an example and not by way of limitation, afirst user may want to search for other users who: (1) are first-degreefriends of the first user; and (2) are associated with StanfordUniversity (i.e., the user nodes 202 are connected by an edge 206 to theconcept node 204 corresponding to the school “Stanford”). The first usermay then enter a text query “friends stanford” into query field 450, asillustrated in FIGS. 5A-5B. As the querying user enters this text queryinto query field 450, social-networking system 160 may provide varioussuggested structured queries, as illustrated in drop-down menus 400. Asused herein, an unstructured text query refers to a simple text stringinputted by a user. The text query may, of course, be structured withrespect to standard language/grammar rules (e.g. English languagegrammar). However, the text query will ordinarily be unstructured withrespect to social-graph elements. In other words, a simple text querywill not ordinarily include embedded references to particularsocial-graph elements. Thus, as used herein, a structured query refersto a query that contains references to particular social-graph elements,allowing the search engine to search based on the identified elements.Furthermore, the text query may be unstructured with respect to formalquery syntax. In other words, a simple text query will not necessarilybe in the format of a query command that is directly executable by asearch engine (e.g., the text query “friends stanford” could be parsedto form the query command “intersect(school(Stanford University),friends(me)”, which could be executed as a query in a social-graphdatabase). Although this disclosure describes receiving particularqueries in a particular manner, this disclosure contemplates receivingany suitable queries in any suitable manner.

In particular embodiments, social-networking system 160 may parse theunstructured text query (also simply referred to as a search query)received from the first user (i.e., the querying user) to identify oneor more n-grams. In general, an n-gram is a contiguous sequence of nitems from a given sequence of text or speech. The items may becharacters, phonemes, syllables, letters, words, base pairs, prefixes,or other identifiable items from the sequence of text or speech. Then-gram may comprise one or more characters of text (letters, numbers,punctuation, etc.) entered by the querying user. An n-gram of size onecan be referred to as a “unigram,” of size two can be referred to as a“bigram” or “digram,” of size three can be referred to as a “trigram,”and so on. Each n-gram may include one or more parts from the text queryreceived from the querying user. In particular embodiments, each n-grammay comprise a character string (e.g., one or more characters of text)entered by the first user. As an example and not by way of limitation,social-networking system 160 may parse the text query “friends stanford”to identify the following n-grams: friends; stanford; friends stanford.As another example and not by way of limitation, social-networkingsystem 160 may parse the text query “friends in palo alto” to identifythe following n-grams: friends; in; palo; alto; friends in; in palo;palo alto; friend in palo; in palo also; friends in palo alto. Inparticular embodiments, each n-gram may comprise a contiguous sequenceof n items from the text query. Although this disclosure describesparsing particular queries in a particular manner, this disclosurecontemplates parsing any suitable queries in any suitable manner. Inconnection with element detection and parsing search queries, particularembodiments may utilize one or more systems, components, elements,functions, methods, operations, or steps disclosed in U.S. patentapplication Ser. No. 13/556,072, filed 23 Jul. 2012, U.S. patentapplication Ser. No. 13/732,101, filed 31 Dec. 2012, each of which isincorporated by reference.

In particular embodiments, social-networking system 160 may generate oneor more structured queries. The structured queries may be based on thenatural-language strings generated by one or more grammars of a grammarmodel. Each structured query may include references to one or more ofthe identified nodes or one or more of the identified edges 206. Thistype of structured query may allow social-networking system 160 to moreefficiently search for resources and content related to the onlinesocial network (such as, for example, profile pages) by searching forcontent connected to or otherwise related to the identified user nodes202 and the identified edges 206. As an example and not by way oflimitation, in response to the text query, “show me friends of mygirlfriend,” social-networking system 160 may generate a structuredquery “Friends of Stephanie,” where “Friends” and “Stephanie” in thestructured query are references corresponding to particular social-graphelements. The reference to “Stephanie” would correspond to a particularuser node 202 (where social-networking system 160 has parsed the n-gram“my girlfriend” to correspond with a user node 202 for the user“Stephanie”), while the reference to “Friends” would correspond tofriend-type edges 206 connecting that user node 202 to other user nodes202 (i.e., edges 206 connecting to “Stephanie's” first-degree friends).When executing this structured query, social-networking system 160 mayidentify one or more user nodes 202 connected by friend-type edges 206to the user node 202 corresponding to “Stephanie”. As another exampleand not by way of limitation, in response to the text query, “friendswho like facebook,” social-networking system 160 may generate astructured query “Friends who like Facebook,” where “Friends,” “like,”and “Facebook” in the structured query are references corresponding toparticular social-graph elements as described previously (i.e., afriend-type edge 206, a like-type edge 206, and concept node 204corresponding to the company “Facebook”). Although this disclosuredescribes generating particular structured queries in a particularmanner, this disclosure contemplates generating any suitable structuredqueries in any suitable manner.

In particular embodiments, social-networking system 160 may receive fromthe querying user a selection of one of the structured queries. Thenodes and edges referenced in the received structured query may bereferred to as the selected nodes and selected edges, respectively. Asan example and not by way of limitation, the web browser 132 on thequerying user's client system 130 may display the sent structuredqueries in a drop-down menu 300, as illustrated in FIGS. 5A-5B, whichthe user may then click on or otherwise select (e.g., by simply keying“enter” on his keyboard) to indicate the particular structured query theuser wants social-networking system 160 to execute. Upon selecting aparticular structured query, the user's client system 130 may call orotherwise instruct to social-networking system 160 to execute theselected structured query. Although this disclosure describes receivingselections of particular structured queries in a particular manner, thisdisclosure contemplates receiving selections of any suitable structuredqueries in any suitable manner.

More information on generating structured queries and grammar models maybe found in U.S. patent application Ser. No. 13/556,072, filed 23 Jul.2012, U.S. patent application Ser. No. 13/674,695, filed 12 Nov. 2012,and U.S. patent application Ser. No. 13/731,866, filed 31 Dec. 2012,each of which is incorporated by reference.

In particular embodiments, social-networking system 160 may generate aquery command based on a query (e.g., a text query or a structuredquery) received from a querying user. The query command may then be usedin a search against objects in a data store 164 of the social-networkingsystem 160. In particular embodiments, the query command may be providedfor a search using search indices for one or more data stores orverticals of social-networking system 160. The query command maycomprise one or more query constraints. Each query constraint may beidentified by social-networking system 160 based on a parsing of thequery by a parsing algorithm. Each query constraint may be a request fora particular object-type. In particular embodiments, the query commandmay comprise query constraints in symbolic expression or s-expression.Social-networking system 160 may parse the structured query “Photos Ilike” to a query command (photos_liked_by:<me>). The query command(photos_liked_by: <me>) denotes a query for photos liked by a user(i.e., <me>, which corresponding to the querying user), with a singleresult-type of photo. The query constraint may include, for example,social-graph constraints (e.g., requests for particular nodes ornodes-types, or requests for nodes connected to particular edges oredge-types), object constraints (e.g., request for particular objects orobject-types), location constraints (e.g., requests for objects orsocial-graph entities associates with particular geographic locations),other suitable constraints, or any combination thereof. In particularembodiments, a query command may comprise prefix and an object. Theobject may correspond to a particular node in the social graph 200,while the prefix may correspond to a particular edge 206 or edge-type(indicating a particular type of relationship) connecting to theparticular node in the social graph 200. As an example and not by way oflimitation, the query command (pages_liked_by:<user>) comprises a prefixpages_liked_by, and an object <user>. Although this disclosure describesgenerating particular query commands in a particular manner, thisdisclosure contemplates generating any suitable query commands in anysuitable manner. In particular embodiments, social-networking system 160may generate a query command comprising a “weak and” (WAND) or “strongor” operator (SOR). More information on WAND and SOR operators may befound in U.S. patent application Ser. No. 13/560,901, filed 27 Jul.2012, and U.S. patent application Ser. No. 13/887,049, filed 3 May 2013,which are incorporated by reference.

In particular embodiments, the parsing algorithm used to generate querycommands may comprise one or more parsing-configuration parameters. Theparsing-configuration parameters may specify how to generate a querycommand for a particular type of query received from a user. Theparsing-configuration parameters may specify, for example, instructionsfor generating a query commands having a specified number of queryconstraints for a specified number of objects of a specified object-typeto be retrieved from a specified number of data stores 164. In otherwords, the parsing-configuration parameters may specify the types ofobjects that should be searched and the types/number of verticals 164that should be accessed. For each vertical 164 accessed, theparsing-configuration parameters may specify the number of objects toretrieve from each vertical 164. As an example and not by way oflimitation, in response to a search query input “kais”,social-networking system 160 may generate the following query command:

(AND (name: “kais”)  (OR friends_of: (friends_of: <me>) : num_to_score:50)  (OR pages: <> : num_to_score: 25)).This query command contains a first query constraint (OR friends_of:(friends_of: <me>): num_to_score: 50), which instructs social-networkingsystem 160 to access a users vertical 164 to search for users that arefriends-of-friends of the querying user that match the character string“kais”, and to retrieve the top fifty results. The second queryconstraint, (OR pages: < >: num_to_score: 25), instructssocial-networking system 160 to access a webpages vertical 164 to searchfor pages that match the character string “kais”, and to retrieve thetop twenty-five results. However, this process may be inefficient ifsocial-networking system 160 has to retrieve an excess of objects ofparticular object-types in order to generate a sufficient number ofsearch results. In order to improved the amount of processing (CPU)power consumed when processing queries, social-networking system 160 mayuse parsing-configuration parameters that minimize the number ofobject-types and the number of objects retrieved from each vertical 164,while still retrieving a sufficient number of object to retrieve thetop-N scoring objects. As an example and not by way of limitation,continuing with the prior example, in order to generate the top-10search results, social-networking system 160 may only need to retrievethe top twenty-five friends-of-friends and the top fifteen pages. Thismay be because, for example, the friends-of-friends ranked twenty-six tofifty all have final-scores that put them outside of the top-10 searchresults. Thus, fewer users need to be pulled in order to maintain thesame quality of search results. This allows the processing powerconsumed by each search query. The parsing-configuration parameters maybe revised so that more or less object-types (and possibly additionalverticals 164) are searched, or that more or less objects of eachobject-type are retrieved. Although this disclosure describes generatingparticular query commands in a particular manner, this disclosurecontemplates generating any suitable query commands in any suitablemanner.

In particular embodiments, social-networking system 160 may retrieveobjects from one or more verticals 164 that match at least a portion ofthe query constraints of a query command. Social-networking system 160may access one or more verticals 164 in response to a search queryreceived from a user, as specified by the query command. Each vertical164 may store one or more objects associated with the online socialnetwork. The number and type of verticals 164 accessed in response tothe search query may be based on the query constraints of the querycommand. Each vertical 164 may store objects associated with the onlinesocial network of the object-type specified by the query constraint. Asan example and not by way of limitation, one of the query constraints ofa query command for users, social-networking system 160 may access ausers vertical 164 to identify one or more users who match the query.Social-networking system 160 may identify matching objects in anysuitable manner, such as, for example, by using one or more stringmatching algorithms to match the character string with a string ofcharacters associated with each of one or more of the objects. As anexample and not by way of limitation, in response to a search queryinput “kais”, social-networking system 160 may access one or more usersverticals 164 and one or more pages verticals 164 and search theaccessed verticals to identify objects (e.g., user-profile pages orconcept-profile pages) stored in those verticals. Social-networkingsystem 160 may submit the following query command to each accessedvertical:

(AND (name: “kais”)  (OR friends_of: (friends_of: <me>) : num_to_score:50)  (OR pages: <> : num_to_score: 25)).Social-networking system 160 may access the index servers 330 of eachvertical 164, causing index server 330 to return results that match thequery command. As an example and not by way of limitation,social-networking system 160 may access index server 330 of a usersvertical 164, causing index server 330 to identify users <Kaisen L>,<Nathen Kaiser>, <Catie Kaiser>, and <Alex Kaiser> (each represented byan user identifier). That is, users <Kaisen L>, <Nathen Kaiser>, <CatieKaiser>, and <Alex Kaiser> may have a name matching “kais”. Furthermore,each of these identified users matches the query constraint (friends_of:(friends_of: <me>)), which request objects corresponding to user thatare friend-of-friends of the querying user. Social-networking system 160may also access index server 330 of a pages vertical 164, causing indexserver 330 to identify the page for the band <Kaiser Chiefs>. That is,the band <Kaiser Chiefs> has a name matching “kais”. Furthermore, theidentify page matches the query constraint (pages: < >), which requestobjects corresponding to pages. In particular embodiments,social-networking system 160 may identify objects matching a querycommand by traversing the social graph 200 from the particular nodealong the particular connecting edges 206 (or edge-types) to nodescorresponding to objects specified by query command in order to identifyone or more search results. As an example and not by way of limitation,the query command (pages_liked_by:<user>) may be executed bysocial-networking system 160 by traversing the social graph 200 from auser node 202 corresponding to <user> along like-type edges 206 toconcept nodes 204 corresponding to pages liked by <user>. Although thisdisclosure describes searching for objects in a particular manner, thisdisclosure contemplates searching for objects in any suitable manner.

In particular embodiments, when searching verticals 164 to identifymatching objects, social-networking system 160 may only identify andscore up to a threshold number of matching nodes in a particularvertical 164. When social-networking system 160 retrieves objects from avertical 164 in response to a query (or a particular query constraint),the objects may be retrieved based on a static-score or static-rank ofthe indexed objects. As an example and not by way of limitation, theobjects with the static-ranks, up to the threshold number, may beretrieved and further processed, for example, by a scoring algorithmthat may calculate a final-score for the retrieved objects based on avariety of factors in order to determine search results to send back tothe querying user. Each object stored in a vertical 164 may beassociated with a pre-determined static-score based on a static-scoringalgorithm. In particular embodiments, the pre-determined static-score ofeach object may a pre-determined ranking of the object for a particulartype of query. As an example and not by way of limitation, when astructured query comprises “friends of Alex” (which may be a portion ofa larger query, such as, “photos of friends of Alex”, or “friends offriends of Alex”), user nodes 202 corresponding to friends of the user“Alex” may have pre-determined static-scores with respect to thisstructured query. Alex's top-three friends may be, for example, “Larry”,“Moe,” and “Joe”, ranked in that order. Thus, when searching a usersvertical 164 in response to the query “friends of Alex” (or the querycommand friends_of:<Alex>), the users “Larry”, “Moe,” and “Joe” may beretrieved as the top-three objects. When searching a vertical 164,social-networking system 160 may retrieve objects based on thestatic-scores of the objects, where the objects with the highest/beststatic-scores may be retrieved. The threshold number of matching objectsmay then be scored and ranked by the social-networking system 160. Thethreshold number may be chosen to enhance search quality or to optimizethe processing of search results. As an example and not by way oflimitation, social-networking system 160 may only identify the top-Nmatching objects (i.e., the number to score, or “num_to_score” for ans-expression in the examples used herein) in a users vertical 164 inresponse to a query command requesting users. The top-N objects may bedetermined by their static-scores (e.g., ranking based on the currentsocial-graph affinity of the user with respect to the querying user) ofthe objects in a search index corresponding to the users vertical 164.The static-scores may be pre-determined by social-networking system 160using a static-scoring algorithm. However, this process may beinefficient if social-networking system 160 has to retrieve an excessnumber of objects from a vertical 164 in order to find the top-N scoringobjects according the scoring algorithm that determines which objects tosend back to a user as search results. As an example and not by way oflimitation, social-networking system 160 may access a particularvertical 164 in response to a query and retrieves one-hundred matchingobjects, where each object has an associated static-rank. A final-scoremay then be calculated for these one-hundred objects (e.g., based onsocial-graph affinity) by a scoring algorithm. The top-5 scoring objectsaccording to the scoring-algorithm may be, for example, objects having astatic-rank of 4, 12, 20, 78, and 95. This process could be improved,for example, if the top-N objects static-rank were the same as the top-Nobjects by final-rank. By more closely aligning the static-rank ofobject with the final-ranks calculated by the search engine,social-networking system may be able to reduce the number of matchingobjects it needs to retrieve and score in order to generate a sufficientnumber of search results. In particular embodiments, the static-score ofan object may be based on the search query itself. In other words,depending on the particular query or query-type, an object may have adifferent static-score with respect to that query or query-type. As anexample and not by way of limitation, if the number to score is 500, thetop 500 objects may be identified. These 500 objects may then be scoresbased on one or more factors (e.g., match to the search query or otherquery constraints, social-graph affinity, search history, etc.), and thetop M results may then be generated as search results to display to thequerying user. In particular embodiments, the top results after one ormore rounds of rankings may be sent to an aggregator 320 for a finalround of ranking, where identified objects may be reordered, redundantresults may be dropped, or any other type of results-processing mayoccur before presentation to the querying user. Although this disclosuredescribes identifying particular numbers of objects, this disclosurecontemplates identifying any suitable numbers of objects. Furthermore,although this disclosure describes ranking objects in a particularmanner, this disclosure contemplates ranking objects in any suitablemanner.

In particular embodiments, social-networking system 160 may score one ormore objects identified as matching a query constraint. The score (alsoreferred to as a final-score) for each retrieved/identified object maybe calculated in any suitable manner, such as, for example, by using aparticular scoring algorithm. Each identified object may correspond to aparticular user node 202 or concept node 204 of social graph 200. When aquery command includes a plurality of query constraints,social-networking system 160 may score the nodes matching each queryconstraint independently or jointly. Social-networking system 160 mayscore the first set of identified nodes by accessing a data store 164corresponding to the object-type of the identified nodes. As an exampleand not by way of limitation, when generating identified nodes matchingthe query constraint (extract authors: (term posts_liked_by: <Mark>)),social-networking system 160 may identify the set of users (<Tom>,<Dick>, <Harry>) in the user vertical 164. Social-networking system 160may then score the users <Tom>, <Dick>, and <Harry> based on theirrespective social-affinity with respect to the user <Mark>. For example,social-networking system 160 of the post vertical 164 may then score theidentified nodes of users <Tom>, <Dick>, and <Harry> based on a numberof posts in the list of posts liked by the user <Mark>. The users <Tom>,<Dick>, and <Harry> may have authored the following posts liked by theuser <Mark>: <post 1>, <post 2>, <post 3>, <post 4>, <post 5>, <post 6>.If user <Dick> authored posts <post 1>, <post 2>, <post 3>, user <Tom>authored posts <post 5> and <post 6>, and user <Harry> authored post<post 4>, social-networking system 160 may score user <Dick> as highestsince his authored most of the posts in the list of posts liked by theuser <Mark>, with <Tom> and <Harry> having consecutively lower scores.As another example and not by way of limitation, using the priorexample, social-networking system 160 may access a forward index thatmaps a post to a count of likes of the post. The index server may accessthe forward index and retrieve counts of likes for each post of the listof posts liked by the user <Mark>. The index server may score the postsin the list of posts (i.e., <post 1>, <post 2>, <post 3>, <post 4>,<post 5>, <post 6>) based on respective counts of likes, and return tosocial-networking system 160 authors of top scored posts (e.g., top 3scored or most liked posts) as the first identified node. After eachappropriate scoring factor is considered for a particular identifiednode, an overall score for the identified node may be determined. Basedon the scoring of the nodes, social-networking system 160 may thengenerate one or more sets of identified nodes. As an example and not byway of limitation, social-networking system 160 may only generate a setof identified nodes corresponding to nodes having a score greater than athreshold score. As another example and not by way of limitation,social-networking system 160 may rank the scored nodes and then onlygenerate a set of identified nodes corresponding to nodes having a rankgreater than a threshold rank (e.g., top ten, top twenty, etc.).Although this disclosure describes scoring matching nodes in aparticular manner, this disclosure contemplates scoring matching nodesin any suitable manner.

In particular embodiments, social-networking system 160 may score thesearch results based on a social-graph affinity associated with thequerying user (or the user node 202 of the querying user). The scoringalgorithm used to score retrieved object may use social-graph affinityas a factor. Social-networking system 160 may determine the social-graphaffinity (which may be referred to herein as “affinity”) of varioussocial-graph entities for each other. Affinity may represent thestrength of a relationship or level of interest between particularobjects associated with the online social network, such as users,concepts, content, actions, advertisements, other objects associatedwith the online social network, or any suitable combination thereof. Inparticular embodiments, social-networking system 160 may measure orquantify social-graph affinity using an affinity coefficient (which maybe referred to herein as “coefficient”). The coefficient may representor quantify the strength of a relationship between particular objectsassociated with the online social network. The coefficient may alsorepresent a probability or function that measures a predictedprobability that a user will perform a particular action based on theuser's interest in the action. In particular embodiments, social-graphaffinity may be used as a factor when scoring search results. As anexample and not by way of limitation, in response to the structuredquery “Photos of my friends”, social-networking system 160 may generatethe query command (photos_of(users:<friends>)), and may determine thatthe search intent of this query is to view group photos showing theuser's friends. When scoring identified concept nodes 204 correspondingto photos with the user's friends tagged in the photo, social-networkingsystem 160 may score photos better based on the querying user'srespective social-graph affinity (e.g., as measured by a affinitycoefficient) of the user's tagged in the photo with respect to thequerying user. Furthermore, photos showing more of the querying user'sfriends may be tagged higher than photos showing fewer of the user'sfriends, since having more friends tagged in the photo may increase thequerying user's affinity with respect to that particular photo. Althoughthis disclosure describes scoring search results based on affinity in aparticular manner, this disclosure contemplates scoring search resultsbased on affinity in any suitable manner. Furthermore, in connectionwith social-graph affinity and affinity coefficients, particularembodiments may utilize one or more systems, components, elements,functions, methods, operations, or steps disclosed in U.S. patentapplication Ser. No. 11/503,093, filed 11 Aug. 2006, U.S. patentapplication Ser. No. 12/977,027, filed 22 Dec. 2010, U.S. patentapplication Ser. No. 12/978,265, filed 23 Dec. 2010, and U.S. patentapplication Ser. No. 13/632,869, filed 1 Oct. 2012, each of which isincorporated by reference.

In particular embodiments, social-networking system 160 may determineone or more revised static-scores for one or more of the retrievedobjects based on a comparison of the final-scores and the static-scoresof the retrieved objects. The static-scores associated with indexedobject may be improved by revising the static-scores based onexperiments run using archived search queries. The archived queries canbe parsed to generate query commands, which can be submitted to avertical 164 in order to retrieve a first number of objects based ontheir static-scores. The retrieved objects can have their final-scorescalculated. The final-scores can then be compared to the static-scores,and the static-scores can be modified so they more closely match thefinal-scores. This can be done for a variety of queries, so that thestatic-scores are optimized to match the final-scores as closely aspossible for a variety of queries. In particular embodiments,social-networking system 160 may revise the static-scoring algorithmbased on the revised static-scores. The static-scoring algorithm may berevised to calculate pre-determined static-scores for objects based onone or more of the revised static-scores of one or more of the retrievedobjects, respectively. In particular embodiments, social-networkingsystem 160 may revise static-scores by determining a difference betweenthe pre-determined static-score for each object and the calculatedfinal-score for each object. Social-networking system 160 may thenrevise one or more of the static-scores of one or more of the objectsbased on the determined differences. As an example and not by way oflimitation, continuing with a previous example, if the top-5 objects byfinal-score according to the scoring-algorithm may be, for example,objects having a static-rank of 4, 12, 20, 78, and 95. The static-ranksof all the objects may be revised upward so that these objects havestatic-ranks closer to 1-to-5. Note that, theoretically the idealstatic-ranks would be 1, 2, 3, 4, and 5. However, because thefinal-scores may be based on a variety of factors, such as social-graphaffinity and user history, the ideal static-ranks with respect to afirst querying user or a first query-type may be different than theideal static-ranks with respect to a second querying user or a secondquery-type. Thus, the static-ranks of objects may be revised to theymore closely match the final-ranks of objects with respect to a varietyof users and query-types. Although this disclosure describes revisingstatic-scoring algorithms in a particular manner, this disclosurecontemplates revising static-scoring algorithms in any suitable manner.

In particular embodiments, social-networking system 160 may generate oneor more revised parsing-configuration parameters based on a comparisonof the final-scores of the retrieved objects and the specified number ofobjects of the query constraints. The parsing algorithm may be improvedby revising the way query constraints are generated based on experimentsrun using archived search queries. The archived queries can be parsed togenerate query commands, which can be submitted to one or more verticals164 in order to retrieve a first number of objects. Social-networkingsystem 160 may then calculate final-scores for the retrieved objects,and the final-scores may then be analyzed to determine whether thenumber of objects retrieved for any specified object-type can be reducedwhile still retrieving some or all of the top-N scoring results. Inparticular embodiments, social-networking system 160 may revise theparsing algorithm based on the parsing-configuration parameters suchthat one or more of the specified number of objects of a specifiedobject-type is reduced based on the revised parsing-configurationparameters. As an example and not by way of limitation, for a particularquery command s-expression generated by the parsing algorithm inresponse to a particular query, social-networking system 160 may revisethe parsing-configuration parameters used to generate that query commandso the specified number of objects specified by “num_to_score” isreduced while still retrieving some or all of the top-N scoring results(e.g., retrieving a sufficient number of the top-N scoring results tomaintain a threshold quality of search results). If the num_to_score canbe reduced, then the parsing algorithm (or particularparsing-configuration parameters) may be revised to retrieve fewerobjects or object-types. The amount that num_to_score is reduced maycorrelated directly to processing power consumed by social-networkingsystem 160. As these experiments are run using archived queries,social-networking system 160 may generate data of score-quality versusCPU power (or simply num_to_score), and use that data to find a pointwhere, for particular queries or query-types, social-networking system160 is still retrieving sufficient high-quality results (i.e.,high-scoring results) while significantly reducing the power consumed.In other words, it may be worthwhile to sacrifice some search resultquality if there is enough savings in processing power. In particularembodiments, social-networking system 160 may revise the parsingalgorithm based on the parsing-configuration parameters such that one ormore of the query constraints is removed from the query commandsgenerated by the parsing algorithm based on the revisedparsing-configuration parameters. In particular embodiments,social-networking system 160 may revise the parsing algorithm based onthe parsing-configuration parameters such that one or more of thespecified number of data stores 164 to access is reduced based on therevised parsing-configuration parameters. As an example and not by wayof limitation, continuing with a prior example, in response to a searchquery input “kais”, social-networking system 160 may generate thefollowing query command:

(AND (name: “kais”)  (OR friends_of: (friends_of: <me>) : num_to_score:50)  (OR pages: <> : num_to_score: 25)).If an analysis of the final-scores of the retrieved pages from the pagesvertical 164 shows that none of the retrieved pages are within the top-Nresults, then that entire query constraint may be removed. In otherwords, the parsing algorithm may be revised so that pages verticals 164are not searched in response to this query-type. In particularembodiments, social-networking system 160 may revise the parsingalgorithm based on the number of objects that need to be retrieved fromthe data store in order to retrieve all objects having a final-scoregreater than or equal to a threshold score. As an example and not by wayof limitation, social-networking system may identify each retrievedobject having a score (or rank) greater than or equal to a thresholdscore. Social-networking system 160 may then determine, for each queryconstraint of each query command, a number of objects that need to beretrieved from the data store to retrieve each identified object havinga score greater than or equal to the threshold score. Based on thedetermined number of objects that need to be retrieved from the datastore, social-networking system 160 may then revise one or more of theparsing-configuration parameters. Although this disclosure describesrevising parsing algorithms in a particular manner, this disclosurecontemplates revising parsing algorithms in any suitable manner.

FIG. 6 illustrates an example method 600 for improving thestatic-scoring of objects for search queries. The method may begin atstep 610, where social-networking system 160 may access a first set ofqueries of an online social network received from one or more users ofthe online social network. At step 620, social-networking system 160 mayretrieve, for each query of the first set of queries, a first number ofobjects that match at least a portion of the query from one or more datastores 164. Each data store 164 may store one or more objects associatedwith the online social network. Furthermore, each object may beassociated with a pre-determined static-score based on a static-scoringalgorithm. Social-networking system 160 may retrieve the first number ofobjects based on the static-scores of the objects. At step 630,social-networking system 160 may calculate, for each query, afinal-score for each retrieved object based on a final-scoringalgorithm. At step 640, social-networking system 160 may determine oneor more revised static-scores for one or more of the retrieved objectsbased on a comparison of the final-scores and the static-scores of theretrieved objects. Particular embodiments may repeat one or more stepsof the method of FIG. 6, where appropriate. Although this disclosuredescribes and illustrates particular steps of the method of FIG. 6 asoccurring in a particular order, this disclosure contemplates anysuitable steps of the method of FIG. 6 occurring in any suitable order.Moreover, although this disclosure describes and illustrates an examplemethod for improving the static-scoring of objects for search queriesincluding the particular steps of the method of FIG. 6, this disclosurecontemplates any suitable method for improving the static-scoring ofobjects for search queries including any suitable steps, which mayinclude all, some, or none of the steps of the method of FIG. 6, whereappropriate. Furthermore, although this disclosure describes andillustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 6, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 6.

FIG. 7 illustrates an example method 700 for improving the parsing ofsearch queries. The method may begin at step 710, wheresocial-networking system 160 may access a first set of queries of anonline social network received from one or more users of the onlinesocial network. At step 720, social-networking system 160 may parse eachquery in the first set of queries using a first parsing algorithm togenerate a query command based on each query. Each query command maycomprise one or more query constraints. Furthermore, each queryconstraint may be for a specified number of objects of a specifiedobject-type as specified by one or more parsing-configuration parametersof the first parsing algorithm. At step 730, social-networking system160 may retrieve, for each query constraint of each query command, thespecified number of objects that match at least a portion of the queryconstraint from one or more data stores 164. Each data store 164 maystore one or more objects associated with the online social network ofthe specified object-type for the query constraint. At step 740,social-networking system 160 may score, for each query command, eachretrieved object based on a first scoring algorithm. At step 750,social-networking system 160 may generate one or more revisedparsing-configuration parameters based on a comparison of the scores ofthe retrieved objects and the specified number of objects of the queryconstraints. Particular embodiments may repeat one or more steps of themethod of FIG. 7, where appropriate. Although this disclosure describesand illustrates particular steps of the method of FIG. 7 as occurring ina particular order, this disclosure contemplates any suitable steps ofthe method of FIG. 7 occurring in any suitable order. Moreover, althoughthis disclosure describes and illustrates an example method forimproving the parsing of search queries including the particular stepsof the method of FIG. 7, this disclosure contemplates any suitablemethod for improving the parsing of search queries including anysuitable steps, which may include all, some, or none of the steps of themethod of FIG. 7, where appropriate. Furthermore, although thisdisclosure describes and illustrates particular components, devices, orsystems carrying out particular steps of the method of FIG. 7, thisdisclosure contemplates any suitable combination of any suitablecomponents, devices, or systems carrying out any suitable steps of themethod of FIG. 7.

In particular embodiments, in response to a query received from aquerying user, social-networking system 160 may generate one or moresearch results, where the search results correspond to the query.Social-networking system 160 may identify objects (e.g., users, photos,profile pages (or content of profile pages), etc.) that satisfy orotherwise match the query. Each search result may correspond to a nodeof social graph 200. A search result corresponding to each identifiedobject may then be generated. As an example and not by way oflimitation, in response to the query “Photos of Matt and Stephanie”,social-networking system 160 may identify a photo where the user's“Matt” and “Stephanie” are both tagged in the photo. A search resultcorresponding to this photo may then be generated and sent to the user.In particular embodiments, each search result may be associated with oneor more objects, where each query constraint of the query commandcorresponding to the query is satisfied by one or more of the objectsassociated with that particular search result. As an example and not byway of limitation, continuing with the prior example, in response to thestructured query “Photos of Matt and Stephanie”, social-networkingsystem 160 may parse the query to generate the query command(intersect(photos_of:<Matt>), (photos_of:<Stephanie>)), which could beexecuted to generate a search result corresponding to a photo where theuser's “Matt” and “Stephanie” (who were both referenced in thestructured query) are both tagged in the photo (i.e., their user nodes202 are connected by tagged-in-type edges 206 to the concept node 204corresponding to the photo). In other words, the constraints for(photos_of:<Matt>) and (photos_of:<Stephanie>) are both satisfied by thephoto because it is connected to the user nodes 202 for the user's“Matt” and “Stephanie”. The nodes identified as matching the query maybe scored (and possibly ranked), and then one or more (e.g., a thresholdnumber) may be generated as search result to display to the user.Although this disclosure describes generating search results in aparticular manner, this disclosure contemplates generating searchresults in any suitable manner.

In particular embodiments, social-networking system 160 may send one ormore search results to the querying user. The search results may be sentto the user, for example, in the form of a list of links on thesearch-results webpage, each link being associated with a differentwebpage that contains some of the identified resources or content. Inparticular embodiments, each link in the search results may be in theform of a Uniform Resource Locator (URL) that specifies where thecorresponding webpage is located and the mechanism for retrieving it.Social-networking system 160 may then send the search-results webpage tothe web browser 132 on the user's client system 130. The user may thenclick on the URL links or otherwise select the content from thesearch-results webpage to access the content from social-networkingsystem 160 or from an external system (such as, for example, third-partysystem 170), as appropriate. In particular embodiments, each searchresult may include link to a profile page and a description or summaryof the profile page (or the node corresponding to that page). The searchresults may be presented and sent to the querying user as asearch-results page. When generating the search results,social-networking system 160 may generate one or more snippets for eachsearch result, where the snippets are contextual information about thetarget of the search result (i.e., contextual information about thesocial-graph entity, profile page, or other content corresponding to theparticular search result). In particular embodiments, social-networkingsystem 160 may only send search results having a score/rank over aparticular threshold score/rank. As an example and not by way oflimitation, social-networking system 160 may only send the top tenresults back to the querying user in response to a particular searchquery. Although this disclosure describes sending particular searchresults in a particular manner, this disclosure contemplates sending anysuitable search results in any suitable manner.

More information on generating search results may be found in U.S.patent application Ser. No. 13/731,939, filed 31 Dec. 2012, which isincorporated by reference.

FIG. 8 illustrates an example computer system 800. In particularembodiments, one or more computer systems 800 perform one or more stepsof one or more methods described or illustrated herein. In particularembodiments, one or more computer systems 800 provide functionalitydescribed or illustrated herein. In particular embodiments, softwarerunning on one or more computer systems 800 performs one or more stepsof one or more methods described or illustrated herein or providesfunctionality described or illustrated herein. Particular embodimentsinclude one or more portions of one or more computer systems 800.Herein, reference to a computer system may encompass a computing device,and vice versa, where appropriate. Moreover, reference to a computersystem may encompass one or more computer systems, where appropriate.

This disclosure contemplates any suitable number of computer systems800. This disclosure contemplates computer system 800 taking anysuitable physical form. As example and not by way of limitation,computer system 800 may be an embedded computer system, a system-on-chip(SOC), a single-board computer system (SBC) (such as, for example, acomputer-on-module (COM) or system-on-module (SOM)), a desktop computersystem, a laptop or notebook computer system, an interactive kiosk, amainframe, a mesh of computer systems, a mobile telephone, a personaldigital assistant (PDA), a server, a tablet computer system, or acombination of two or more of these. Where appropriate, computer system800 may include one or more computer systems 800; be unitary ordistributed; span multiple locations; span multiple machines; spanmultiple data centers; or reside in a cloud, which may include one ormore cloud components in one or more networks. Where appropriate, one ormore computer systems 800 may perform without substantial spatial ortemporal limitation one or more steps of one or more methods describedor illustrated herein. As an example and not by way of limitation, oneor more computer systems 800 may perform in real time or in batch modeone or more steps of one or more methods described or illustratedherein. One or more computer systems 800 may perform at different timesor at different locations one or more steps of one or more methodsdescribed or illustrated herein, where appropriate.

In particular embodiments, computer system 800 includes a processor 802,memory 804, storage 806, an input/output (I/O) interface 808, acommunication interface 810, and a bus 812. Although this disclosuredescribes and illustrates a particular computer system having aparticular number of particular components in a particular arrangement,this disclosure contemplates any suitable computer system having anysuitable number of any suitable components in any suitable arrangement.

In particular embodiments, processor 802 includes hardware for executinginstructions, such as those making up a computer program. As an exampleand not by way of limitation, to execute instructions, processor 802 mayretrieve (or fetch) the instructions from an internal register, aninternal cache, memory 804, or storage 806; decode and execute them; andthen write one or more results to an internal register, an internalcache, memory 804, or storage 806. In particular embodiments, processor802 may include one or more internal caches for data, instructions, oraddresses. This disclosure contemplates processor 802 including anysuitable number of any suitable internal caches, where appropriate. Asan example and not by way of limitation, processor 802 may include oneor more instruction caches, one or more data caches, and one or moretranslation lookaside buffers (TLBs). Instructions in the instructioncaches may be copies of instructions in memory 804 or storage 806, andthe instruction caches may speed up retrieval of those instructions byprocessor 802. Data in the data caches may be copies of data in memory804 or storage 806 for instructions executing at processor 802 tooperate on; the results of previous instructions executed at processor802 for access by subsequent instructions executing at processor 802 orfor writing to memory 804 or storage 806; or other suitable data. Thedata caches may speed up read or write operations by processor 802. TheTLBs may speed up virtual-address translation for processor 802. Inparticular embodiments, processor 802 may include one or more internalregisters for data, instructions, or addresses. This disclosurecontemplates processor 802 including any suitable number of any suitableinternal registers, where appropriate. Where appropriate, processor 802may include one or more arithmetic logic units (ALUs); be a multi-coreprocessor; or include one or more processors 802. Although thisdisclosure describes and illustrates a particular processor, thisdisclosure contemplates any suitable processor.

In particular embodiments, memory 804 includes main memory for storinginstructions for processor 802 to execute or data for processor 802 tooperate on. As an example and not by way of limitation, computer system800 may load instructions from storage 806 or another source (such as,for example, another computer system 800) to memory 804. Processor 802may then load the instructions from memory 804 to an internal registeror internal cache. To execute the instructions, processor 802 mayretrieve the instructions from the internal register or internal cacheand decode them. During or after execution of the instructions,processor 802 may write one or more results (which may be intermediateor final results) to the internal register or internal cache. Processor802 may then write one or more of those results to memory 804. Inparticular embodiments, processor 802 executes only instructions in oneor more internal registers or internal caches or in memory 804 (asopposed to storage 806 or elsewhere) and operates only on data in one ormore internal registers or internal caches or in memory 804 (as opposedto storage 806 or elsewhere). One or more memory buses (which may eachinclude an address bus and a data bus) may couple processor 802 tomemory 804. Bus 812 may include one or more memory buses, as describedbelow. In particular embodiments, one or more memory management units(MMUs) reside between processor 802 and memory 804 and facilitateaccesses to memory 804 requested by processor 802. In particularembodiments, memory 804 includes random access memory (RAM). This RAMmay be volatile memory, where appropriate Where appropriate, this RAMmay be dynamic RAM (DRAM) or static RAM (SRAM). Moreover, whereappropriate, this RAM may be single-ported or multi-ported RAM. Thisdisclosure contemplates any suitable RAM. Memory 804 may include one ormore memories 804, where appropriate. Although this disclosure describesand illustrates particular memory, this disclosure contemplates anysuitable memory.

In particular embodiments, storage 806 includes mass storage for data orinstructions. As an example and not by way of limitation, storage 806may include a hard disk drive (HDD), a floppy disk drive, flash memory,an optical disc, a magneto-optical disc, magnetic tape, or a UniversalSerial Bus (USB) drive or a combination of two or more of these. Storage806 may include removable or non-removable (or fixed) media, whereappropriate. Storage 806 may be internal or external to computer system800, where appropriate. In particular embodiments, storage 806 isnon-volatile, solid-state memory. In particular embodiments, storage 806includes read-only memory (ROM). Where appropriate, this ROM may bemask-programmed ROM, programmable ROM (PROM), erasable PROM (EPROM),electrically erasable PROM (EEPROM), electrically alterable ROM (EAROM),or flash memory or a combination of two or more of these. Thisdisclosure contemplates mass storage 806 taking any suitable physicalform. Storage 806 may include one or more storage control unitsfacilitating communication between processor 802 and storage 806, whereappropriate. Where appropriate, storage 806 may include one or morestorages 806. Although this disclosure describes and illustratesparticular storage, this disclosure contemplates any suitable storage.

In particular embodiments, I/O interface 808 includes hardware,software, or both, providing one or more interfaces for communicationbetween computer system 800 and one or more I/O devices. Computer system800 may include one or more of these I/O devices, where appropriate. Oneor more of these I/O devices may enable communication between a personand computer system 800. As an example and not by way of limitation, anI/O device may include a keyboard, keypad, microphone, monitor, mouse,printer, scanner, speaker, still camera, stylus, tablet, touch screen,trackball, video camera, another suitable I/O device or a combination oftwo or more of these. An I/O device may include one or more sensors.This disclosure contemplates any suitable I/O devices and any suitableI/O interfaces 808 for them. Where appropriate, I/O interface 808 mayinclude one or more device or software drivers enabling processor 802 todrive one or more of these I/O devices. I/O interface 808 may includeone or more I/O interfaces 808, where appropriate. Although thisdisclosure describes and illustrates a particular I/O interface, thisdisclosure contemplates any suitable I/O interface.

In particular embodiments, communication interface 810 includeshardware, software, or both providing one or more interfaces forcommunication (such as, for example, packet-based communication) betweencomputer system 800 and one or more other computer systems 800 or one ormore networks. As an example and not by way of limitation, communicationinterface 810 may include a network interface controller (NIC) ornetwork adapter for communicating with an Ethernet or other wire-basednetwork or a wireless NIC (WNIC) or wireless adapter for communicatingwith a wireless network, such as a WI-FI network. This disclosurecontemplates any suitable network and any suitable communicationinterface 810 for it. As an example and not by way of limitation,computer system 800 may communicate with an ad hoc network, a personalarea network (PAN), a local area network (LAN), a wide area network(WAN), a metropolitan area network (MAN), or one or more portions of theInternet or a combination of two or more of these. One or more portionsof one or more of these networks may be wired or wireless. As anexample, computer system 800 may communicate with a wireless PAN (WPAN)(such as, for example, a BLUETOOTH WPAN), a WI-FI network, a WI-MAXnetwork, a cellular telephone network (such as, for example, a GlobalSystem for Mobile Communications (GSM) network), or other suitablewireless network or a combination of two or more of these. Computersystem 800 may include any suitable communication interface 810 for anyof these networks, where appropriate. Communication interface 810 mayinclude one or more communication interfaces 810, where appropriate.Although this disclosure describes and illustrates a particularcommunication interface, this disclosure contemplates any suitablecommunication interface.

In particular embodiments, bus 812 includes hardware, software, or bothcoupling components of computer system 800 to each other. As an exampleand not by way of limitation, bus 812 may include an AcceleratedGraphics Port (AGP) or other graphics bus, an Enhanced Industry StandardArchitecture (EISA) bus, a front-side bus (FSB), a HYPERTRANSPORT (HT)interconnect, an Industry Standard Architecture (ISA) bus, an INFINIBANDinterconnect, a low-pin-count (LPC) bus, a memory bus, a Micro ChannelArchitecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, aPCI-Express (PCIe) bus, a serial advanced technology attachment (SATA)bus, a Video Electronics Standards Association local (VLB) bus, oranother suitable bus or a combination of two or more of these. Bus 812may include one or more buses 812, where appropriate. Although thisdisclosure describes and illustrates a particular bus, this disclosurecontemplates any suitable bus or interconnect.

Herein, a computer-readable non-transitory storage medium or media mayinclude one or more semiconductor-based or other integrated circuits(ICs) (such, as for example, field-programmable gate arrays (FPGAs) orapplication-specific ICs (ASICs)), hard disk drives (HDDs), hybrid harddrives (HHDs), optical discs, optical disc drives (ODDs),magneto-optical discs, magneto-optical drives, floppy diskettes, floppydisk drives (FDDs), magnetic tapes, solid-state drives (SSDs),RAM-drives, SECURE DIGITAL cards or drives, any other suitablecomputer-readable non-transitory storage media, or any suitablecombination of two or more of these, where appropriate. Acomputer-readable non-transitory storage medium may be volatile,non-volatile, or a combination of volatile and non-volatile, whereappropriate.

Herein, “or” is inclusive and not exclusive, unless expressly indicatedotherwise or indicated otherwise by context. Therefore, herein, “A or B”means “A, B, or both,” unless expressly indicated otherwise or indicatedotherwise by context. Moreover, “and” is both joint and several, unlessexpressly indicated otherwise or indicated otherwise by context.Therefore, herein, “A and B” means “A and B, jointly or severally,”unless expressly indicated otherwise or indicated otherwise by context.

The scope of this disclosure encompasses all changes, substitutions,variations, alterations, and modifications to the example embodimentsdescribed or illustrated herein that a person having ordinary skill inthe art would comprehend. The scope of this disclosure is not limited tothe example embodiments described or illustrated herein. Moreover,although this disclosure describes and illustrates respectiveembodiments herein as including particular components, elements,functions, operations, or steps, any of these embodiments may includeany combination or permutation of any of the components, elements,functions, operations, or steps described or illustrated anywhere hereinthat a person having ordinary skill in the art would comprehend.Furthermore, reference in the appended claims to an apparatus or systemor a component of an apparatus or system being adapted to, arranged to,capable of, configured to, enabled to, operable to, or operative toperform a particular function encompasses that apparatus, system,component, whether or not it or that particular function is activated,turned on, or unlocked, as long as that apparatus, system, or componentis so adapted, arranged, capable, configured, enabled, operable, oroperative.

What is claimed is:
 1. A method comprising, by one or more computingdevices: accessing a first data set, wherein the first data setcomprises a list of objects matching a first query, a pre-determinedstatic-rank for each object calculated based on a static-scoringalgorithm, and a final-rank for each object calculated based on afinal-scoring algorithm; and revising the static-scoring algorithm basedon a comparison of the static-ranks and the final-ranks of each objectlisted in the first data set, wherein the static-scoring algorithm isrevised in order to reduce a difference between the static-ranks andfinal-ranks of the objects listed in the first data set.
 2. The methodof claim 1, further comprising: receiving, from a client system of afirst user of an online social network, the first query, wherein thefirst query is a particular type of query; identifying a plurality ofobjects matching the first query from one or more data stores, each datastore storing one or more objects of one or more object-types,respectively, wherein each object is identified based at least in parton the static-rank of the object; and generating the list of objectsfrom the identified plurality of objects.
 3. The method of claim 2,wherein the static-rank for each object is based at least in part on thetype of the first query.
 4. The method of claim 2, wherein identifyingthe plurality of objects matching the first query from one or more datastores comprises: retrieving, from each data store, a specified numberof objects matching the first query, wherein the specified number ofobjects for each data store is based on the object-type of the objectsstored by the data store; and aggregating the retrieved objects from theone or more data stores.
 5. The method of claim 4, further comprising:revising one or more of the specified numbers of objects for one or moreof the data stores, respectively, based at least in part on the revisedstatic-scoring algorithm.
 6. The method of claim 2, further comprising:parsing the first query using a first parsing algorithm to generate aquery command based on the first query, the query command comprising oneor more query constraints, each query constraint being for a specifiednumber of objects of a specified object-type as specified by the firstparsing algorithm.
 7. The method of claim 6, wherein identifying theplurality of objects matching the first query from one or more datastores comprises: accessing one or more data stores storing objects ofthe specified object-types of the query constraints of the query commandcorresponding to the first query; and identifying one or more objectsfrom the data stores that match at least a portion of the queryconstraints of the query command corresponding to the first query. 8.The method of claim 6, wherein the specified object-type is selectedfrom a group consisting of: a user, a photo, a post, a webpage, anapplication, a location, and a user group.
 9. The method of claim 2,wherein each data store is selected from a group consisting of: a usersdata store, a photos data store, a posts data store, a webpages datastore, an applications data store, a locations data store, and auser-groups data store.
 10. The method of claim 1, further comprising:revising one or more static-ranks for one or more objects listed in thefirst data set, respectively, based on a comparison of the static-rankand the final-rank of each object.
 11. The method of claim 10, whereinrevising one or more static-ranks for one or more objects listed in thefirst data set comprises: determining, for each object listed in thefirst data set, a difference between the pre-determined static-rank forthe object and the calculated final-rank for the object; and revisingone or more of the static-ranks of one or more of the objects,respectively, based on the determined differences.
 12. The method ofclaim 1, further comprising: calculating one or more revisedstatic-ranks for one or more objects listed in the first data set,respectively, based on the revised static-scoring algorithm.
 13. Themethod of claim 1, wherein the pre-determined static-rank of each objectis based on a pre-determined static-score of the object calculated basedon the static-scoring algorithm.
 14. The method of claim 1, wherein thefinal-rank of each object is based on a final-score of the objectcalculated based on the final-scoring algorithm.
 15. The method of claim1, further comprising: accessing a social graph comprising a pluralityof nodes and a plurality of edges connecting the nodes, each of theedges between two of the nodes representing a single degree ofseparation between them, the nodes comprising: a first nodecorresponding to a first user of the online social network; and aplurality of second nodes corresponding to a plurality of objectsassociated with the online social network, respectively; wherein thefirst query corresponds to the first node, and each object listed in thefirst data set corresponds to a particular second node of the pluralityof second nodes.
 16. The method of claim 15, wherein the first query isa structured query comprising references to one or more selected nodesfrom the plurality of nodes and one or more selected edges from theplurality of edges.
 17. The method of claim 1, wherein the first queryis an unstructured text query comprising one or more n-grams.
 18. Themethod of claim 1, wherein the first query is an archived query from auser of the online social network.
 19. One or more computer-readablenon-transitory storage media embodying software that is operable whenexecuted to: access a first data set, wherein the first data setcomprises a list of objects matching a first query, a pre-determinedstatic-rank for each object calculated based on a static-scoringalgorithm, and a final-rank for each object calculated based on afinal-scoring algorithm; and revise the static-scoring algorithm basedon a comparison of the static-ranks and the final-ranks of each objectlisted in the first data set, wherein the static-scoring algorithm isrevised in order to reduce a difference between the static-ranks andfinal-ranks of the objects listed in the first data set.
 20. A systemcomprising: one or more processors; and a memory coupled to theprocessors comprising instructions executable by the processors, theprocessors operable when executing the instructions to: access a firstdata set, wherein the first data set comprises a list of objectsmatching a first query, a pre-determined static-rank for each objectcalculated based on a static-scoring algorithm, and a final-rank foreach object calculated based on a final-scoring algorithm; and revisethe static-scoring algorithm based on a comparison of the static-ranksand the final-ranks of each object listed in the first data set, whereinthe static-scoring algorithm is revised in order to reduce a differencebetween the static-ranks and final-ranks of the objects listed in thefirst data set.